<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');


require_once('include/generic/SugarWidgets/SugarWidgetField.php');
class SugarWidgetSubPanelDownloadRevisionButton extends SugarWidgetField
{
        function displayHeaderCell(&$layout_def)
        {
                return '&nbsp;';
        }

	function displayList(&$layout_def)
	{
		global $app_strings;

		if($layout_def['DetailView']){
			$icon_create_revision_text = $app_strings['LNK_DOWNLOAD_LATEST_REVISION'];
	                $icon_create_revision_html = SugarThemeRegistry::current()->getImage( 'Download', 'alt="' . $icon_create_revision_text . '" border="0"');

	                return "<a href='index.php?entryPoint=download&id=".$layout_def['fields']['DOCUMENT_REVISION_ID']."&type=".$layout_def['module']."'>" . $icon_create_revision_html.$icon_create_revision_text ."</a>&nbsp;";
		}else{
			return '';
		}
	}
		
}
?>
